package com.xuan.temper.controller;

import com.xuan.temper.entity.Date;
import com.xuan.temper.service.DateService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Date)表控制层
 *
 * @author makejava
 * @since 2020-09-01 10:45:13
 */
@RestController
@RequestMapping("date")
public class DateController {
    /**
     * 服务对象
     */
    @Resource
    private DateService dateService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public Date selectOne( String todayDate) {
        return this.dateService.queryById(todayDate);
    }

    @GetMapping("queryYearHolidy")
    public List<Date> queryYearHolidy (String date){
        String year = date.substring(0, 4);
        System.out.println(year);
        return dateService.queryYearHolidy(year);
    }
}
